import * as typeChecker from './typeChecker';
/**
 * 查询参数序列化
 * @param params
 */
export const paramsSerializer = (params:any) => {
  const newParams = {
    ...params
  };

  if (typeChecker.isNumber(newParams.page)) {
    newParams.page = params.page
  }
  return Object
    .keys(newParams)
    .filter(key => typeChecker.isValidValue(newParams[key]) && !typeChecker.isEmptyChart(newParams[key]))
    .map(key => `${key}=${newParams[key]}`)
    .join('&');
}